﻿using EkStudio.com.bean.xml.reflection;
using EkStudio.com.bean.xml.RootInterface.FieldEvent;
using System.Collections.Generic;

namespace EkStudio.com.bean.xml.RootInterface.Field
{
    public class BillUiFieldsDropListStyle:BillObjectInterface
    {
        private int type = 0;

        private List<BillUiFieldsDropListDefault> defaultList;
        private BillDataFillsqlSource sqlText;
        private BillDataFillsqlWhere sqlWhere;
        private BillDataFillSqlValue sqlValue;

        [Xml("type")]
        public int Type
        {
            get
            {
                return type;
            }

            set
            {
                type = value;
            }
        }
        [XmlElement("item")]
        public List<BillUiFieldsDropListDefault> DefaultList
        {
            get
            {
                return defaultList;
            }

            set
            {
                defaultList = value;
            }
        }
        [XmlElement("sql")]
        public BillDataFillsqlSource SqlText
        {
            get
            {
                return sqlText;
            }

            set
            {
                sqlText = value;
            }
        }
        [XmlElement("sqlWhere")]
        public BillDataFillsqlWhere SqlWhere
        {
            get
            {
                return sqlWhere;
            }

            set
            {
                sqlWhere = value;
            }
        }
        [XmlElement("setValue")]
        public BillDataFillSqlValue SqlValue
        {
            get
            {
                return sqlValue;
            }

            set
            {
                sqlValue = value;
            }
        }
        [XmlTransient]
        public object ParentBean
        {
            get
            {
                return null;
            }

            set
            {
                
            }
        }

        public object Clone()
        {
            BillUiFieldsDropListStyle clone = new BillUiFieldsDropListStyle();
            List<BillUiFieldsDropListDefault> list = new List<BillUiFieldsDropListDefault>();
            if (this.defaultList != null && this.defaultList.Count > 0)
            {
                for (int i = 0; i < this.defaultList.Count; i++)
                {
                    BillUiFieldsDropListDefault it = (BillUiFieldsDropListDefault)(this.defaultList[i].Clone());
                    list.Add(it);
                }
            }
            clone.DefaultList = list;
            clone.Type = type;
            if (this.sqlText != null)
            {
                clone.SqlText = (BillDataFillsqlSource)this.sqlText.Clone();
            }
            if (this.sqlWhere != null)
            {
                clone.SqlWhere = (BillDataFillsqlWhere)this.sqlWhere.Clone();
            }
            if (this.sqlValue != null)
            {
                clone.SqlValue = (BillDataFillSqlValue)this.sqlValue.Clone();
            }

            return clone;
        }

        public override string ToString()
        {
            return "[Expression]";
        }
    }
}
